
//Icon Contorl

pics=new Array()

var n=6; // Icon Number

for(i=0; i < n; i++){

 pics[i]='pics'+i;

}

var ns=(document.layers);

var ns6=(document.getElementById&&!document.all);

var ie=(document.all);

var y=null;

var x=null;

var z=null;

var w=null;//Alternate id. Not used for this script.

if (ns||ns6){

window.captureEvents(Event.MOUSEDOWN | Event.MOUSEMOVE | Event.MOUSEUP);

document.releaseEvents(Event.MOUSEMOVE);

}

if (ns){window.onmousedown=down;window.onmouseup=up}

if (ie||document.getElementById){document.onmousedown=down;document.onmouseup=up}

function down(e){

if (ns){

 window.onmousemove=move;

 if (document.layers['pics'+e.target.name]){

 z=document.layers['pics'+e.target.name];

 y=e.layerY;

 x=e.layerX;

 document.layers['pics'+e.target.name].zIndex=n++;

 }

else {return true}

w=z.name.charAt(z.name.length-1);

}

if (ie && window.event.srcElement.parentElement){

 document.onmousemove=move;

 if  (window.event.srcElement.parentElement.id.indexOf("pics") != -1){

 z=window.event.srcElement.parentElement;

 y=window.event.offsetY;

 x=window.event.offsetX;

 w=window.event.srcElement.parentElement.id.charAt(window.event.srcElement.parentElement.id.length-1);

 window.event.srcElement.parentElement.style.zIndex=n++;

 }

}

if (ns6){

 document.onmousemove=move;

 if  (e.target.parentNode.id.indexOf("pics") != -1){

 z=e.target.parentNode.style;

 x=e.clientX - parseInt(z.left);

 y=e.clientY - parseInt(z.top);

 w=e.target.parentNode.id.charAt(e.target.parentNode.id.length-1);

 z.zIndex=n++;

 }

}

return false;

}

function move(e){

if (ns && z){z.left=e.pageX-x;z.top=e.pageY-y;}

if (ns6 && z){z.top=parseInt(e.clientY)-y;z.left=parseInt(e.clientX)-x}

if (ie && z){z.style.posLeft=window.event.clientX-x;z.style.posTop=window.event.clientY-y}

return false;

}

function up(e){

if (ie||ns6)document.onmousemove=null;

if (ns)window.onmousemove=null;

z=null;

}



function arrayIcon(){

	var winW //window Width

	winW=document.body.clientWidth

	var winH //window Height

	winH=document.body.clientHeight //window Height

	var minWinW=778

	var minWinH=500

	var iconW=100 //Icon Width

	var iconH=110 //Icon Height

	var topM=120 //Top Margin

	var rightM=115 //Right Margin

	var rows

	var cols

	var row

	var col



	if(winW<minWinW && winH<minWinH){

		pics0.style.posTop=topM+iconH*2
		pics0.style.posLeft=minWinW-rightM-iconW*2
		pics1.style.posTop=topM+iconH*1
		pics1.style.posLeft=minWinW-rightM
		pics2.style.posTop=topM+iconH*2
		pics2.style.posLeft=minWinW-rightM
		pics3.style.posTop=topM+iconH*3
		pics3.style.posLeft=minWinW-rightM-iconW*2

		pics4.style.posTop=topM+iconH*3
		pics4.style.posLeft=minWinW-rightM-iconW*2
		pics5.style.posTop=topM+iconH*3
		pics5.style.posLeft=minWinW-rightM-iconW*2
		

	}

	else{

		rows=3;//parseInt((winH-topM)/iconW)
		cols=parseInt(n/rows)+1

		row=0
		col=0

		for(i=0; i < n; i++){
			obj=eval(pics[i])
			obj.style.posTop=topM+row*iconH
			obj.style.posLeft=winW-rightM-col*iconW
			if(row<rows-1){row=row+1}
			else{row=0;col=col+1}
		}

	}

}
